<template>
	<!-- 修改月初计划详情 -->
	<view class="body">
		<myHeader :title="title"></myHeader>
		<view class="mt-5 p-20">
			<uni-forms :value="formData" ref="form">
				<uni-forms-item label="名称" name="name">
					<uni-easyinput type="text" v-model="formData.name" placeholder="请输入姓名" />
				</uni-forms-item>
				<uni-forms-item label="创建人" name="creator">
					<uni-easyinput type="text" v-model="formData.creator" placeholder="请输入姓名" />
				</uni-forms-item>
				<uni-forms-item label="状态" name="status">
					<radio-group @change="radioChange">
						<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value">
							<view>
								<radio :value="item.value" :checked="index === current" />
							</view>
							<view>{{item.name}}</view>
						</label>
					</radio-group>
				</uni-forms-item>
			</uni-forms>
			<button class="mtb-20 bg-red text-white" @click="update">提交</button>
			<button class="mtb-20 bg-red text-white" ref="updateBtn" @click="pageTo('./monthStartPlan')">返回任务首页</button>

		</view>
	</view>
</template>

<script>
	import myHeader from '../../components/head.vue'
	export default {
		data() {
			return {
				title: ' 月初计划详情',
				search: '',
				btnPattern: {
					buttonColor: '#e20909'
				},
				formData: {
					name: '火星探索',
					creator: '李云龙',
					status: '待完成'
				},
				items: [{
						value: '1',
						name: '待完成'
					},
					{
						value: '2',
						name: '已完成',
					},

				],
				current: 1,


			}
		},
		methods: {
			pageTo(val) {
				uni.navigateTo({
					url: val
				})
			},
			radioChange: function(evt) {
				for (let i = 0; i < this.items.length; i++) {
					if (this.items[i].value === evt.target.value) {
						this.current = i;
						break;
					}
				}
			}
		},
		components: {
			myHeader
		},
	}
</script>

<style>
	@import url("/static/party_building/assets/style/federation.css");
</style>
